Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

ABI Encoder v2 + ABI Spec v6.6 #17

Merged
merged 5 commits into from
Jun 16, 2020
Merged

ABI Encoder v2 + ABI Spec v6.6 #17

merged 5 commits into from
Jun 16, 2020

Conversation

gakonst
Copy link
Owner

@gakonst gakonst commented Jun 16, 2020

Motivation

Partially fixes #5. Some ABI Encoder v2 structs are now supported. More complex ones such as DyDx's contracts are still not supported because they require implementing Tokenize and/or Detokenize for types such as (Address, Address, (Address, Address)) (i.e. nested tuples).

This PR breaks compatibility with ABIs that do not have a stateMutability key in their functions.

(ethabi did not support ABIs which did not include the deprecated constantkeyword. Notably, Vyper produces deprecated ABIs as well.)

Solution

  1. Fork ethabi and cherrypick the useful changes I've seen across various PRs. Details in the recent commits: https://github.com/gakonst/ethabi/commits/master
  2. Expand tuples in codegen, similar logic as here: https://github.com/graphprotocol/solidity-bindgen/blob/master/solidity-bindgen-macros/src/abi_gen.rs#L89-L97.
  3. Re-enable all the more complex Tokenize implementations
  4. Add example for generating bindings: cargo run --example abigen <contract name> path/to/contract.sol will print the bindings to stdout. If you specify an additional path, the generated bindings will be written to the file corresponding to that path

@gakonst gakonst force-pushed the gakonst/abiencoder-v2 branch 3 times, most recently from a2f6edd to e0b4bee Compare June 16, 2020 10:23
@gakonst gakonst force-pushed the gakonst/abiencoder-v2 branch from e0b4bee to 4bc36b3 Compare June 16, 2020 11:37
@gakonst gakonst merged commit 570b45e into master Jun 16, 2020
@gakonst gakonst deleted the gakonst/abiencoder-v2 branch June 16, 2020 12:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codegen for ABIEncoderV2
1 participant